<%--
  Created by IntelliJ IDEA.
  User: fyf
  Date: 2018/11/12
  Time: 9:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>更新教师信息</title>

  <jsp:include page="/common/basecss.jsp" flush="true"/>
  <script src="${pageContext.request.contextPath}/js/jquery-2.1.0.js"></script>
  <script src="${pageContext.request.contextPath}/assets/js/layer-v3.1.0/layer/layer.js"></script>
</head>
<body>


<form id="courseForm" class="form-inline" method="post">

  <h5 class="page-header alert-info" style="padding:10px; margin:0px; margin-bottom:5px;">教师信息</h5>
  <div class="row">

    <div class="form-group">
      <label class="col-sm-3 control-label">教师id</label>
      <div class="col-sm-6">
        <input type="text" name="id" id="id" readonly="readonly" class="form-control input-sm"
               value="${teacher.id}" />
      </div>
    </div>

  </div>

  <div class="row">

    <div class="form-group">
      <label class="col-sm-3 control-label">教师姓名</label>
      <div class="col-sm-6">
        <input type="text" name="teachername" id="teachername" class="form-control input-sm"
               value="${teacher.teachername}" />
      </div>
    </div>

  </div>
  <%--分公司id--%>
  <input type="hidden" name="branchid" id="branchid"   value="${branchid}">


  <div class="row">
    <div class="text-center">
      <input  type="button" id="submitButton" class="btn btn-success" value="保存"/>

    </div>
  </div>
</form>

<script>
    $(function () {


        $("#submitButton").click(function () {

            var params = 'id='+ $("#id").val() + "&teachername=" + $('#teachername').val()+"&branchid=" + $('#branchid').val();

            $.ajax({
                type:'post',
                url:'updateTeacher.go',
                data:params,
                dataType:'json',
                success:function (resData) {
                    if (resData!=null){
                        layer.msg('教师信息更新成功',{icon: 1});
                        /*ajax提交，成功之后父级页面刷新*/
                        setTimeout(function () {
                            parent.location.reload();
                        },1000);

                    } else {
                        layer.msg('教师信息更新失败',{icon: 2});
                    }
                },
                error:function () {

                }
            });
        });




    });


</script>




<jsp:include page="/common/basejs.jsp" flush="true"/>
</body>
</html>
